import {createRouter, createWebHistory} from 'vue-router'
import LoginView from "@/views/account/login/LoginView.vue";
import RegisterView from "@/views/account/register/RegisterView.vue";
import NotFound from "@/views/common/NotFound.vue";
import Unauthorized from "@/views/common/Unauthorized.vue";
import Forbidden from "@/views/common/Forbidden.vue";
import ServerError from "@/views/common/ServerError.vue";
import SecurityView from "@/views/account/security/SecurityView.vue";
import DashBoardHomeView from "@/views/account/dashboard/DashBoardHomeView.vue";
import HomeView from "@/views/home/HomeView.vue";
import DashboardLayout from "@/layout/DashboardLayout.vue";
import ProfileView from "@/views/account/profile/ProfileView.vue";
import ProfileBindingView from "@/views/account/profile/ProfileBindingView.vue";

const routes = [
    //home
    {
        path: '/',
        name: 'Home',
        component: HomeView
    },

    //login
    {
        path: '/login',
        name: 'Login',
        component: LoginView
    },
    //register
    {
        path: '/register',
        name: 'Register',
        component: RegisterView
    },
    {
        path: '/dashboard',
        name: 'Dashboard',
        component: DashboardLayout,
        children: [
            {
                path: '',
                name: 'DashBoardHome',
                component: DashBoardHomeView
            },
            {
                path: '/profile',
                name: 'Profile',
                component: ProfileView
            },

            {
                path: '/profile/bind',
                name: 'ProfileBind',
                component: ProfileBindingView
            },

            {
                path: '/security',
                name: 'Security',
                component: SecurityView
            }
        ]
    },



    //404
    {
        path: '/:pathMatch(.*)*',
        component: NotFound
    },
    {
        path: "/404",
        name: "NotFound",
        component: NotFound
    },
    //401
    {
        path: "/401",
        name: "Unauthorized",
        component: Unauthorized,
    },
    //403
    {
        path: "/403",
        name: "Forbidden",
        component: Forbidden,
    },
    {
        path: "/500",
        name: "ServerError",
        component: ServerError,
    },

]

const router = createRouter({
    mode: 'history',
    history: createWebHistory(),
    routes,
})

export default router


